package org.zxl.api.platform.proxy;

import org.zxl.api.common.PlatformInfoCache;
import org.zxl.api.common.dto.CloudRequestEntity;
import org.zxl.api.common.dto.CloudResponseEntity;
import org.zxl.api.platform.dto.AuthInfo;
import org.zxl.api.platform.dto.LoginReqDTO;
import org.zxl.api.platform.service.PlatformService;

/**
 * 登录代理
 * @author zhangxiaolong
 * @date 2025-02-17 17:33
 **/
public class PlatformServiceLoginProxy {

    public static void before(CloudRequestEntity<LoginReqDTO> loginReq, PlatformService platformService) {
        System.out.println("before");
        /*String cloudPlatformUuid = loginReq.getCloudReqHeader().getCloudPlatformUuid();
        //清空云平台缓存信息
        PlatformInfoCache.clear(cloudPlatformUuid);
        //记录当前云平台对应的service提供者； 用途1:发现鉴权失败，可直接发起登录请求。用途其他：
        PlatformInfoCache.putPlatformService(cloudPlatformUuid ,platformService);*/
    }

    public static void after(CloudRequestEntity<LoginReqDTO> loginReq,CloudResponseEntity<AuthInfo> responseEntity) {
        System.out.println("after");
        /*String cloudPlatformUuid = loginReq.getCloudReqHeader().getCloudPlatformUuid();
        if (responseEntity.getResult()){
            System.out.println("登录成功");
            //放入map中
            PlatformInfoCache.putLoginReqEntity(cloudPlatformUuid,loginReq);
            PlatformInfoCache.putAuthInfo(cloudPlatformUuid,responseEntity.getData());
        }else {
            System.err.println("登录失败");
        }*/

    }
}
